package com.test.nnooolwdeaer.bean_wooden.user_info_wooden;

import android.graphics.Bitmap;

import com.test.nnooolwdeaer.constant_wooden.Constant_wooden;
import com.test.nnooolwdeaer.util_wooden.StringUtil_wooden;
import com.google.gson.Gson;

import org.json.JSONArray;
import org.json.JSONException;

import java.util.ArrayList;

public class CoteBankAccountList_wooden {

    private static class Inner_wooden {
        private static final CoteBankAccountList_wooden instance_wooden = new CoteBankAccountList_wooden();
    }

    private CoteBankAccountList_wooden() {}

    public static CoteBankAccountList_wooden getInstance_wooden() {
        return Inner_wooden.instance_wooden;
    }

    private final ArrayList<CoteBankAccount> bankAccountList = new ArrayList<>();

    public static void parse_wooden(JSONArray jsonArray) {
        Gson gson = new Gson();
        Inner_wooden.instance_wooden.bankAccountList.clear();
        for (int i=0;i<jsonArray.length();i++){
            try {
                CoteBankAccount bankAccount = gson.fromJson(jsonArray.get(i).toString(), CoteBankAccount.class );
                Inner_wooden.instance_wooden.bankAccountList.add(bankAccount);
            } catch (JSONException e) {
                if (Constant_wooden.Debug) e.printStackTrace();
            }
        }

//        for (BankAccount bankAccount: instance.bankAccountList){
//            Log.w("---bankAccount---", bankAccount.toString() );
//        }
    }

    public ArrayList<CoteBankAccount> getBankAccountList_wooden() {
        return bankAccountList;
    }

    public static class CoteBankAccount {

        private String id;
        private String walletMobile;
        private String walletLogo;
        private String walletDesc;

        private Bitmap bitmap;

        public String getId() {
            return StringUtil_wooden.getSafeString_wooden(id);
        }

        public String getWalletMobile() {
            return StringUtil_wooden.getSafeString_wooden(walletMobile);
        }

        public String getWalletLogo() {
            return StringUtil_wooden.getSafeString_wooden(walletLogo);
        }

        public void setBitmap(Bitmap bitmap) {
            this.bitmap = bitmap;
        }

        public Bitmap getBitmap() {
            return bitmap;
        }

        public String getWalletDesc() {
            return StringUtil_wooden.getSafeString_wooden(walletDesc);
        }
    }

}
